﻿//-----------------------------------------------------------------------
// <copyright file="EventLogMessages.cs" company="Craig Longford (deltawolf7@gmail.com)">
//     Copyright (c) Craig Longford. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------

namespace Delta.Mercury.Business
{
    using System;
    using System.Collections.Generic;
    using Delta.Data.DataExpress;

    /// <summary>
    /// Event log messages
    /// </summary>
    [Serializable]
    public class EventLogMessages : List<EventLogMessage>
    {
        #region Constructors
        /// <summary>
        /// Initializes a new instance of the EventLogMessages class.
        /// </summary>
        public EventLogMessages()
        {
        }
        #endregion

        #region Get Messages
        /// <summary>
        /// Load event log from database
        /// </summary>
        /// <returns>EventLogMessage collection</returns>
        public static EventLogMessages Load()
        {
            return DataAccess.GetCollection<EventLogMessages, EventLogMessage>("LoadEventLog", System.Data.CommandType.StoredProcedure);
        }

        /// <summary>
        /// Load event log from database
        /// </summary>
        /// <param name="type">Event Log Type</param>
        /// <returns>EventLogMessage collection</returns>
        public static EventLogMessages Load(EventLogType type)
        {
            Parameters parameters = new Parameters();
            parameters.Add(new Parameter("Type", type));
            return DataAccess.GetCollection<EventLogMessages, EventLogMessage>("LoadEventLog", System.Data.CommandType.StoredProcedure);
        }
        #endregion
    }
}
